#ifndef _WORLD_H_
#define _WORLD_H_

#include <map>

#include "camera.h"
#include "object.h"
#include "color.h"

/** \brief Represents a game world
 *
 * 	This class is used to manage the game world and all of its contents. It
 * 	keeps track of what Object are in the world and allows them to
 * 	Object::act(), as well as Object::draw() them to the screen. Also keeps
 * 	track of the Camera which is associated with viewing the World.
 *
 * 	Objects are stored based on their selection color, for quick retrieval
 * 	when given the selection color of a particular object.
 */
class World
{
	std::map<int, Object*> _objects; /**< Map of objects, stored by selection
									index for easy access during
									selection*/
	Camera _camera; /**< Camera associated with World */
	int _selectIndex; /**< Next available color for object selection mode*/

	public:
		/** \brief Constructs World
		 *
		 * 	Creates an empty world, with a Camera oriented at the origin
		 * 		with no rotation.
		 */
		World();
		/** \brief Destroys World
		 *
		 * 	Preferred method of destruction is global warming. 
		 */
		~World();

		/** \brief Put an Object into World
		 *
		 * 	Adds the Object \a o into the World, and assigns it a unique
		 * 	selection color.
		 *
		 * 	\param o Object to be added
		 *
		 */
		void put(Object* o);

		/** \brief Get the camera associated with World
		 *
		 * 	\return Reference to the Camera associated with this world
		 */
		Camera& getCamera();

		/** \brief Draws the World and all Object in it
		 *
		 * 	Calls Object::draw() for all Object in World.
		 */
		void draw();
		
		/** \brief Makes every Object in World act
		 *
		 * 	Calls Object::act() for all Object in World.
		 */
		void act();
};

#endif
